import java.util.Random;
import java.util.Scanner;//使用Scanner函数必须导入包
public class Study {
   /* public static void main(String[] args) {
        int a=1;
        while(a<=10){
            System.out.println(a);
            a++;
        }
        System.out.println("nihao");
    }*/

    /*public static void main(String[] args) {
        //break用法,结束所有循环
        int a=1;
        *//*while(a<10){
            if(a==2)
                break;
            System.out.println(a);
            a++;
        }*//*
        //continue用法
        while(a<=10){
            if(a==2)
            {continue;}//遇到continue结束本躺循环，break和continue只针对当前循环
            System.out.println(a);
            a++;
        }
    }*/
    /*public static void main(String[] args) {
        int i;
        for ( i = 1; i <=100 ; i++) {
            if(i%3==0&&i%5==0){
                System.out.println(i);
                continue;
            }

        }
    }*/
    //输出
    /*public static void main07(String[] args) {
        System.out.println("输出且换行");
        System.out.print("输出且不换行");
        System.out.printf("%s\n","格式化输出和c语言一样！");
        Scanner sss=new Scanner(System.in);//sss是变量名
        int n=sss.nextInt();
        System.out.println(n);
        Scanner sss=new Scanner(System.in);
        System.out.println("请输入姓名");
        //next遇到空格就结束
        String name=sss.next();
        System.out.println(name);
        //上边读取完sss.next按下回车后，该回车会被下边的nextLine读取到
        //解决办法，提取下边的sss.nextLine提前放
        sss.nextLine();
        System.out.println("请输入姓名2");
        Scanner ss01=new Scanner(System.in);
        String name2=sss.nextLine();
        System.out.println(name2);
        sss.close();
    }*/
    public static void main(String[] args) {
        Random random=new Random();
        int ranNum=random.nextInt(50)+100;//生成50到100的整数
        System.out.println(ranNum);
        while(true){
            System.out.println("请输入你要猜的数据");
            Scanner scan=new Scanner(System.in);
            int num=scan.nextInt();
            if(num>ranNum){
                System.out.println("猜大了");
            } else if (num==ranNum) {
                System.out.println("猜对了");
                break;//猜对就退出
            }else {
                System.out.println("猜小了");
            }
        }
    }
}
//调试
